package com.example.redis.demo.configure;

import com.example.redis.demo.annotations.WebControllerAnnotationHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class WebMvcConfigure extends WebMvcConfigurationSupport {

    @Autowired
    private WebControllerAnnotationHandler webControllerAnnotationHandler;

    /**
     * 把自定义的拦截器加入到请求拦截注册器里面
     *
     * @param registry
     */

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(webControllerAnnotationHandler).addPathPatterns("/user/**");
        super.addInterceptors(registry);
    }
}
